using ImageCSharp.Core.Interfaces;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Processing;
using System.ComponentModel.Composition;

namespace ImageCSharp.Plugins.Transforms
{
    /// <summary>
    /// 调整大小变换
    /// </summary>
    [Export(typeof(IImagePlugin))]
    public class ResizeTransform : IImagePlugin
    {
        public string Name => "调整大小";
        public string Description => "调整图像尺寸";
        public string Category => "变换";

        public Image ProcessImage(Image image)
        {
            // 这里应该有具体的调整大小参数
            // 为了演示，我们使用固定的大小
            int newWidth = 800;
            int newHeight = 600;
            
            image.Mutate(x => x.Resize(newWidth, newHeight));
            return image;
        }
    }

    /// <summary>
    /// 旋转变换
    /// </summary>
    [Export(typeof(IImagePlugin))]
    public class RotateTransform : IImagePlugin
    {
        public string Name => "旋转";
        public string Description => "旋转图像";
        public string Category => "变换";

        public Image ProcessImage(Image image)
        {
            // 默认旋转90度
            float angle = 90;
            image.Mutate(x => x.Rotate(angle));
            return image;
        }
    }

    /// <summary>
    /// 翻转变换
    /// </summary>
    [Export(typeof(IImagePlugin))]
    public class FlipTransform : IImagePlugin
    {
        public string Name => "翻转";
        public string Description => "水平或垂直翻转图像";
        public string Category => "变换";

        public Image ProcessImage(Image image)
        {
            // 默认水平翻转
            image.Mutate(x => x.Flip(FlipMode.Horizontal));
            return image;
        }
    }
}